/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:DELL
 * Date:2025-01-24
 * Time:23:58
 */
public class Demo5 {
    public static void main(String[] args) {
        Thread t1=new Thread(()->{
            for (int i = 0; i < 5; i++) {
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
            System.out.println("t1结束！");
        });
        Thread t2=new Thread(()->{
            try {
                t1.join();
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("t2结束！");
        });
        t1.start();
        t2.start();
        System.out.println("主线程结束！");
    }
}
